/*
 * File:   Factory.h
 * Author: Elevator
 *
 * Created on 9 Июнь 2013 г., 14:59
 */

#ifndef FACTORY_H
#define FACTORY_H

#include <string>
#include "Common/Common.h"
#include "Logic/Creature/Detail.h"
#include "Logic/Creature/Junction.h"
#include "Logic/Creature/Creature.h"
#include "Logic/Map/Obstacle.h"
#include "Logic/Map/Map.h"

class Factory
{
public:

	Map* CreateMap( ) const;
	void DestroyMap( Map* map ) const;

	Obstacle* CreateObstacle( std::string id ) const;
	void DestroyObstacle( Obstacle* obstacle ) const;

	Creature* CreateCreature( std::string id ) const;
	void DestroyCreature( Creature* creature ) const;

	Detail* CreateDetail( std::string id, const Transform& pos, const TextureInfo* texInfo, const IIterable<Circle>* vertices, float mass, float intertia, float friction, float restitution ) const;
	void DestroyDetail( Detail* detail ) const;

	physics::IBody* CreateBody( physics::IBody::Type bodyType, const Transform& pos, const IIterable<Circle>* circles, float mass, float intertia, float friction, float restitution ) const;
	void DestroyBody( physics::IBody* body ) const;

	Junction* CreateJunction( std::string id, const Detail* detailA, const Detail* detailB, Vec2 pos, float torque ) const;
	void DestroyJunction( Junction* junction ) const;

	static const Factory& GetInstance( );

private:
	static Factory _factory;
};

#endif	/* FACTORY_H */

